<?php
include 'functions.php';
$filetype='';
if(isset($_FILES['my_little_file']) && !$_FILES['my_little_file']['error']) {
    if($_POST['my_little_file_name']!='')
    {
    $filetype= $_FILES['my_little_file']['type'];
	$uploadfile = 'files/' . basename($_FILES['my_little_file']['name']);
        
//	if (move_uploaded_file($_FILES['my_little_file']['tmp_name'], $uploadfile)) {
//            
//		echo "File is valid, and was successfully uploaded (" . ((int)($_FILES['my_little_file']['size']/1024)) ." KB).<br/>";
//		echo "<a href='" . $uploadfile . "'>View uploaded file: " . $_FILES['my_little_file']['name'] ."</a><br/>";
//                sleep(3);
//                //header("Location: index.php");
//                
//	} else {
//		echo "Possible file upload attack!\n";
//	}
        
        
       try{
         $dbh=connect();
         transaction($dbh);         
         $dbh = null;
           
     }catch(PDOException $e){
           print "Error!: " .$e->GetMessage(). "</br>";
           die();
            }
    }
    else{
        die('nazwij plik');
    }
} else {
	die('No file attached or error occured.');
}
?>